﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FormulParserNamespace
{
    public class Variable
    {
        protected string name;
        protected double currentValue;

        public Variable(string _name)
        {
            name = string.Copy(_name);
            currentValue = 0;
        }

        public Variable(string _name, double _value)
        {
            name = string.Copy(_name);
            currentValue = _value;
        }

        public string getName()
        {
            return name; 
        }

        public double getCurrentValue()
        {
            return currentValue;
        }

        public void setValue(double _value)
        {
            currentValue = _value;
        }

        public static bool operator ==(Variable var1, Variable var2)
        {
            if (var1.getName().Equals(var2.getName())) return true;
            else return false;
        }

        public static bool operator !=(Variable var1, Variable var2)
        {
            return !(var1 == var2);
        }

        public override bool Equals(object ob)
        {
            return this == (Variable)ob;
        }
    }
}
